package com.flurry.android;

import android.text.TextUtils;
import com.flurry.android.responses.AppCloudApplyOperationResonseHandler;
import com.flurry.android.responses.AppCloudCommonOperationResponseHandler;
import com.flurry.android.responses.AppCloudError;
import com.flurry.android.responses.AppCloudGetObjectByIDResponseHandler;
import java.util.Vector;
import org.apache.http.NameValuePair;
import org.json.JSONObject;

public class AppCloudObject extends cx
{
  AppCloudObject(String paramString)
  {
    this.mCollectionName = paramString;
  }

  public AppCloudObject(JSONObject paramJSONObject)
  {
    createObject(paramJSONObject);
  }

  public static AppCloudSearch SearchWithCollectionName(String paramString)
  {
    if (AppCloudUser.getCurrentUser() == null);
    while (TextUtils.isEmpty(paramString))
      return null;
    return new AppCloudSearch(paramString);
  }

  public static AppCloudObject create(String paramString)
  {
    return new AppCloudObject(paramString);
  }

  public static void getObjectById(String paramString1, String paramString2, AppCloudGetObjectByIDResponseHandler paramAppCloudGetObjectByIDResponseHandler)
    throws Exception
  {
    AppCloudObject localAppCloudObject = new AppCloudObject(paramString2);
    localAppCloudObject.setId(paramString1);
    localAppCloudObject.getObjectOrUser(new bn(paramAppCloudGetObjectByIDResponseHandler));
  }

  public void addObserverForKey(String paramString, AppCloudValueUpdateHandler paramAppCloudValueUpdateHandler)
  {
    if (TextUtils.isEmpty(this.mId))
    {
      paramAppCloudValueUpdateHandler.onError(new AppCloudError(400, "Please assign an object id."));
      return;
    }
    if (TextUtils.isEmpty(this.mCollectionName))
    {
      paramAppCloudValueUpdateHandler.onError(new AppCloudError(400, "Please assign a collection name."));
      return;
    }
    r.a(this.mId, this.mCollectionName, paramString, paramAppCloudValueUpdateHandler);
  }

  public void decrement(String paramString, float paramFloat, AppCloudCommonOperationResponseHandler paramAppCloudCommonOperationResponseHandler)
    throws Exception
  {
    if (TextUtils.isEmpty(this.mId))
    {
      AppCloudResponse localAppCloudResponse1 = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign an object id.\"}"));
      paramAppCloudCommonOperationResponseHandler.onError(new AppCloudError(localAppCloudResponse1.getHTTPResponseCode(), localAppCloudResponse1.getResponseMessage()));
      return;
    }
    if (TextUtils.isEmpty(this.mCollectionName))
    {
      AppCloudResponse localAppCloudResponse2 = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign a collection name.\"}"));
      paramAppCloudCommonOperationResponseHandler.onError(new AppCloudError(localAppCloudResponse2.getHTTPResponseCode(), localAppCloudResponse2.getResponseMessage()));
      return;
    }
    super.decrement(paramString, String.valueOf(paramFloat), paramAppCloudCommonOperationResponseHandler);
  }

  public void decrement(String paramString, int paramInt, AppCloudCommonOperationResponseHandler paramAppCloudCommonOperationResponseHandler)
    throws Exception
  {
    if (TextUtils.isEmpty(this.mId))
    {
      AppCloudResponse localAppCloudResponse1 = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign an object id.\"}"));
      paramAppCloudCommonOperationResponseHandler.onError(new AppCloudError(localAppCloudResponse1.getHTTPResponseCode(), localAppCloudResponse1.getResponseMessage()));
      return;
    }
    if (TextUtils.isEmpty(this.mCollectionName))
    {
      AppCloudResponse localAppCloudResponse2 = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign a collection name.\"}"));
      paramAppCloudCommonOperationResponseHandler.onError(new AppCloudError(localAppCloudResponse2.getHTTPResponseCode(), localAppCloudResponse2.getResponseMessage()));
      return;
    }
    super.decrement(paramString, String.valueOf(paramInt), paramAppCloudCommonOperationResponseHandler);
  }

  public void deleteWithCompletionHandler(AppCloudCommonOperationResponseHandler paramAppCloudCommonOperationResponseHandler)
    throws Exception
  {
    if (TextUtils.isEmpty(this.mId))
    {
      AppCloudResponse localAppCloudResponse1 = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign an object id.\"}"));
      paramAppCloudCommonOperationResponseHandler.onError(new AppCloudError(localAppCloudResponse1.getHTTPResponseCode(), localAppCloudResponse1.getResponseMessage()));
      return;
    }
    if (TextUtils.isEmpty(this.mCollectionName))
    {
      AppCloudResponse localAppCloudResponse2 = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign a collection name.\"}"));
      paramAppCloudCommonOperationResponseHandler.onError(new AppCloudError(localAppCloudResponse2.getHTTPResponseCode(), localAppCloudResponse2.getResponseMessage()));
      return;
    }
    delete(new bq(paramAppCloudCommonOperationResponseHandler));
  }

  public String getCollectionName()
  {
    return this.mCollectionName;
  }

  public void getWithCompletionHandler(AppCloudCommonOperationResponseHandler paramAppCloudCommonOperationResponseHandler)
    throws Exception
  {
    if (TextUtils.isEmpty(this.mId))
    {
      AppCloudResponse localAppCloudResponse1 = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign an object id.\"}"));
      paramAppCloudCommonOperationResponseHandler.onError(new AppCloudError(localAppCloudResponse1.getHTTPResponseCode(), localAppCloudResponse1.getResponseMessage()));
      return;
    }
    if (TextUtils.isEmpty(this.mCollectionName))
    {
      AppCloudResponse localAppCloudResponse2 = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign a collection name.\"}"));
      paramAppCloudCommonOperationResponseHandler.onError(new AppCloudError(localAppCloudResponse2.getHTTPResponseCode(), localAppCloudResponse2.getResponseMessage()));
      return;
    }
    getObjectOrUser(new br(paramAppCloudCommonOperationResponseHandler));
  }

  public void increment(String paramString, float paramFloat, AppCloudCommonOperationResponseHandler paramAppCloudCommonOperationResponseHandler)
    throws Exception
  {
    if (TextUtils.isEmpty(this.mId))
    {
      AppCloudResponse localAppCloudResponse1 = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign an object id.\"}"));
      paramAppCloudCommonOperationResponseHandler.onError(new AppCloudError(localAppCloudResponse1.getHTTPResponseCode(), localAppCloudResponse1.getResponseMessage()));
      return;
    }
    if (TextUtils.isEmpty(this.mCollectionName))
    {
      AppCloudResponse localAppCloudResponse2 = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign a collection name.\"}"));
      paramAppCloudCommonOperationResponseHandler.onError(new AppCloudError(localAppCloudResponse2.getHTTPResponseCode(), localAppCloudResponse2.getResponseMessage()));
      return;
    }
    super.increment(paramString, String.valueOf(paramFloat), paramAppCloudCommonOperationResponseHandler);
  }

  public void increment(String paramString, int paramInt, AppCloudCommonOperationResponseHandler paramAppCloudCommonOperationResponseHandler)
    throws Exception
  {
    if (TextUtils.isEmpty(this.mId))
    {
      AppCloudResponse localAppCloudResponse1 = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign an object id.\"}"));
      paramAppCloudCommonOperationResponseHandler.onError(new AppCloudError(localAppCloudResponse1.getHTTPResponseCode(), localAppCloudResponse1.getResponseMessage()));
      return;
    }
    if (TextUtils.isEmpty(this.mCollectionName))
    {
      AppCloudResponse localAppCloudResponse2 = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign a collection name.\"}"));
      paramAppCloudCommonOperationResponseHandler.onError(new AppCloudError(localAppCloudResponse2.getHTTPResponseCode(), localAppCloudResponse2.getResponseMessage()));
      return;
    }
    super.increment(paramString, String.valueOf(paramInt), paramAppCloudCommonOperationResponseHandler);
  }

  final void p(String paramString)
  {
    this.mCollectionName = paramString;
    for (int i = 0; i < getKeyValues().size(); i++)
    {
      String str1 = ((NameValuePair)getKeyValues().get(i)).getName();
      String str2 = ((NameValuePair)getKeyValues().get(i)).getValue();
      FlurryAppCloud.D().getServerData().b(str1, str2, this.mId, this.mCollectionName);
    }
  }

  public void saveOrCreateWithCompletionHandler(AppCloudApplyOperationResonseHandler paramAppCloudApplyOperationResonseHandler)
    throws Exception
  {
    if (TextUtils.isEmpty(this.mCollectionName))
    {
      AppCloudResponse localAppCloudResponse = new AppCloudResponse(new JSONObject("{code:\"400\",note:\"Please assign a collection name.\"}"));
      paramAppCloudApplyOperationResonseHandler.onError(new AppCloudError(localAppCloudResponse.getHTTPResponseCode(), localAppCloudResponse.getResponseMessage()));
      return;
    }
    super.saveOrCreateWithCompletionHandler(paramAppCloudApplyOperationResonseHandler);
  }

  public String toString()
  {
    String str = "" + "Collection name = " + this.mCollectionName + " ; ";
    return str + super.toString();
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.flurry.android.AppCloudObject
 * JD-Core Version:    0.6.2
 */